package com.newtouch.bxzs.business.statistics.controller;

import com.newtouch.bxzs.business.config.MyLog;
import com.newtouch.bxzs.business.statistics.model.bo.*;
import com.newtouch.bxzs.business.statistics.model.vo.ActivityAchievementListVO;
import com.newtouch.bxzs.business.statistics.model.vo.ActivityAchievementVO;
import com.newtouch.bxzs.business.statistics.model.vo.ActivityProductSaleRankingVO;
import com.newtouch.bxzs.business.statistics.service.ActivityAchievementService;
import com.newtouch.bxzs.common.base.response.BaseResponse;
import com.newtouch.bxzs.common.base.response.RespGenerator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 活动期业绩查询Controller
 *
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021/3/3 9:26</td>
 * <td>tianshangzhu</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author tianshangzhu
 * @version 1.0.0
 * @since 1.0.0
 */
@Api(tags = "活动期业绩")
@RestController
@RequestMapping("/activityAchievementController")
@SuppressWarnings("unchecked")
public class ActivityAchievementController {

    /**
     * 静态变量：系统日志
     */
    private static final Log logger = LogFactory.getLog(IncomeController.class);

    @Resource
    private ActivityAchievementService activityAchievementService;

    @ApiOperation(value = "查询活动期个人业绩信息汇总")
    @PostMapping("/getActivityAchievementSummary")
    @MyLog(systemFunctionName = "活动期业绩", systemFunctionUrl = "/activityAchievementController/getActivityAchievementSummary", userOperationType = 4, userOperationSummary = "查询活动期个人业绩信息汇总")
    public BaseResponse<ActivityAchievementSummaryBO> getActivityAchievementSummary(@RequestBody ActivityAchievementVO activityAchievementVO) {
        logger.info("查询活动期个人业绩信息汇总");
        return RespGenerator.returnOK(activityAchievementService.getActivityAchievementSummary(activityAchievementVO));
    }

    @ApiOperation(value = "查看活动期个人业绩保单列表")
    @PostMapping("/getActivityAchievementPolicyList")
    @MyLog(systemFunctionName = "活动期业绩", systemFunctionUrl = "/activityAchievementController/getActivityAchievementPolicyList", userOperationType = 4, userOperationSummary = "查看活动期个人业绩保单列表")
    public BaseResponse<ActivityAchievementPolicyListBO> getActivityAchievementPolicyList(@RequestBody ActivityAchievementListVO activityAchievementListVO) {
        logger.info("查看活动期个人业绩保单列表");
        return RespGenerator.returnOK(activityAchievementService.getActivityAchievementPolicyList(activityAchievementListVO));
    }

    @ApiOperation(value = "查看活动期个人业绩详情")
    @GetMapping("/getActivityAchievementDetail")
    @MyLog(systemFunctionName = "活动期业绩", systemFunctionUrl = "/activityAchievementController/getActivityAchievementDetail", userOperationType = 4, userOperationSummary = "查看活动期个人业绩详情")
    public BaseResponse<AchievementPolicyDetailBO> getActivityAchievementDetail(@RequestParam("policyNumber") @ApiParam(value = "保单号", required = true) String policyNumber) {
        logger.info("查看活动期个人业绩详情");
        return RespGenerator.returnOK(activityAchievementService.getActivityAchievementDetail(policyNumber));
    }

    @ApiOperation(value = "查看活动期个人业绩排名")
    @PostMapping("/getActivityAchievementRanking")
    @MyLog(systemFunctionName = "活动期业绩", systemFunctionUrl = "/activityAchievementController/getActivityAchievementRanking", userOperationType = 4, userOperationSummary = "查看活动期个人业绩排名")
    public BaseResponse<ActivityAchievementRankingListBO> getActivityAchievementRanking(@RequestBody ActivityAchievementVO activityAchievementVO) {
        logger.info("查看活动期个人业绩排名");
        return RespGenerator.returnOK(activityAchievementService.getActivityAchievementRanking(activityAchievementVO));
    }

    @ApiOperation(value = "查看活动期产品销量排名")
    @PostMapping("/getActivityProductSaleRanking")
    @MyLog(systemFunctionName = "活动期业绩", systemFunctionUrl = "/activityAchievementController/getActivityProductSaleRanking", userOperationType = 4, userOperationSummary = "查看活动期产品销量排名")
    public BaseResponse<ActivityProductSaleRankingListBO> getActivityProductSaleRanking(@RequestBody ActivityProductSaleRankingVO activityProductSaleRankingVO) {
        logger.info("查看活动期产品销量排名");
        return RespGenerator.returnOK(activityAchievementService.getActivityProductSaleRanking(activityProductSaleRankingVO));
    }

}
